// 配置请求根路径
axios.defaults.baseURL = 'http://124.223.14.236:8060/home'
// 请求拦截器发请求带token
axios.interceptors.request.use(config => {
  const token = localStorage.getItem('udd_token')
  if (token) {
    config.headers.token = token
  }
  return config;
}, error => {
  // Do something with request error
  return Promise.reject(error);
})

axios.interceptors.response.use(response => {
  if (response.data.errno === 9998 && response.data.errmsg === '未登录，不允许操作！') {
    location.href = './login.html'
  }
  return response
}, error => {
  // Do something with response error
  return Promise.reject(error)
})